package com.example.serverdemo.utils.stringutils;

public class StringUtils {
    /**
     *  byte数组转16进制字符串
     * @param b
     * @return
     */
    public static String printHexString(byte[] b) {
        StringBuffer sbf = new StringBuffer();
        for (int i = 0; i < b.length; i++) {
            String hex = Integer.toHexString(b[i] & 0xFF);
            if (hex.length() == 1) {
                hex = '0' + hex;
            }
            sbf.append(hex.toUpperCase() + "  ");
        }
        return sbf.toString().trim();
    }
}
